<%--
  Created by IntelliJ IDEA.
  User: 张德峰
  Date: 2021/8/9
  Time: 11:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>显示用户信息</title>
</head>
<body>
<h3>整合成功</h3>
<table>
    <thead>
        <tr>
            <td>编号</td>
            <td>姓名</td>
            <td>性别</td>
            <td>地址</td>
            <td>手机</td>
            <td>邮箱</td>
            <td>用户名</td>
            <td>操作</td>
        </tr>
    </thead>
    <tbody>
    <c:forEach items="${pageData.list}" var="one">
        <tr>
            <td>${one.userId}</td>
            <td>${one.name}</td>
            <td>${one.sex}</td>
            <td>${one.address}</td>
            <td>${one.phone}</td>
            <td>${one.email}</td>
            <td>${one.username}</td>
            <td><a href="#">编辑</a><a href="#">删除</a></td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div>
    <button onclick="firstPage()">首页</button>
    <button onclick="previousPage()">上一页</button>
    <button onclick="nextPage()">下一页</button>
    <button onclick="lastPage()">尾页</button>
    <span>当前第${pageData.currentPage}页，共${pageData.totalPage}页，共${pageData.totalSize}条数据</span>
</div>

<script>
    var pageNumber=${pageData.currentPage};
    var pageSize=${pageData.pageSize};
    var totalPage=${pageData.totalPage};
    function firstPage() {
        if (pageNumber>1){
            pageNumber=1;
            goto();
            //跳转页面
        }

    }function previousPage() {
        if (pageNumber>1){
            pageNumber--;
            goto();
            //跳转页面
        }

    }function nextPage() {
        if (pageNumber<totalPage){
            pageNumber++;
            goto();
            //跳转页面
        }

    }function lastPage() {
        if (pageNumber<totalPage){
            pageNumber=totalPage;
            goto();
            //跳转页面
        }



    }
    function goto() {
        window.location.href="${pageContext.request.contextPath}/user/getAllByPage?pageNumber="+pageNumber+"&pageSize="+pageSize

    }
</script>
</body>
</html>
